package com.boomsecret.pattern.factory.abstractMethod;

import com.boomsecret.pattern.factory.abstractFactory.PizzaIngredientFactory;

/**
 * Created by wangjinliang on 2018/1/31.
 */
public abstract class Pizza {
    protected PizzaIngredientFactory factory = null;

    public Pizza(PizzaIngredientFactory factory) {
        this.factory = factory;
    }

    public abstract String getName();

    public void prepare() {
        System.out.println("Dough:" + factory.createDough().getName());
        System.out.println("Sauce:" + factory.createSauce().getName());
        System.out.println(this.getName() + " prepare success.");
    }
}